<%@ page language="java" import="java.util.*,com.maizhi.util.StringUtil" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";		
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>信息</title>
    <c:import url="/liger/liger.jsp"></c:import>
    
    <style type="text/css">
    	body{font-size:12px;}
    	
    	.tform{font-size:13px; width:100%;}
    	
    	.lh{background-color:#004080;#ffffff;}
    
		.tform th{font-weight:600;padding:3 0;}
		
		.tform td{background-color:#fff;padding:3 0;}
    </style>
    
    <script type="text/javascript">
    function f_edit(){
    	
    	var xjOrder = $("select[name='xjOrder']").val()
    	var orderDays = $("#orderDays").val();
    	var restDays = $("#restDays").val();
    	 
		if(parseFloat(orderDays)>parseFloat(restDays)){
			alert('申请休假天数不允许大于未年休天数!');
			//$.ligerDialog.alert('申请休假天数不允许大于未年休天数!');
			return;
		}
		
		if($("#xjRemark").val().length>200){
			alert('备注描述过长');
			return;
		}

    	var url = "<%=basePath%>hrController.do?xjEdit";
    	$.ligerDialog.waitting("操作进行中,请稍后...");
    	$.ajax({
    		url:url,
    		dataType:'json',
    		data:decodeURIComponent($("#theForm").serialize(),true),
    		success: function(msg) {
                  alert(msg.msg);
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
            	alert("操作错误: "+XMLHttpRequest.status);
	   			//alert(XMLHttpRequest.status);
                //alert(XMLHttpRequest.readyState);
                //alert(textStatus);
            },
            complete: function(XMLHttpRequest, textStatus) {
               $.ligerDialog.closeWaitting();
            }
    	});
    }
    
    </script>
  </head>
  
  <body>
  
  <c:choose>
  	<c:when test="${empty xj}">
  		<table class="tform">
  		<tr>
  		<th colspan=4 class="lh"><h4 style="color:#ffffff;">员工休假编辑流程</h4></td>
  		</tr>
  		<tr>
  		<td>
  		各单位在“丽水移动人力资源管理平台”—“ 考勤管理”中对上个月考勤情况进行填写上报。<br>
		各分公司考勤要求上报数据：<br>年休、调休、事假、病假、产假、探亲假、婚假、丧假、护理假、旷工、迟到、早退；
		<br>以上为下拉菜单选择。
		例：  
		县市分公司：人力资源部<br>（权限固定，各县市管理员只允许查看或填写自己县市或部门的考勤情况，人力资源部权限可查看、修改、删除全市考勤情况）
		员工姓名：潘雁（提供员工所在县市、部门进行模糊选择） <br> 
		员工编号：22465965  <br>
		假期类型：年休（下拉菜单选择） 天数： 1  天；<br>
		实际累计已请年休（下拉菜单选择）天数： 5 天；<br>
		员工实际可年休天数及已休天数由人力资源部钟玲英负责导入、更新数据！
  		</td>
  		</tr>
  	</c:when>
  	
  	<c:otherwise>
  		<table class="tform">
  		<tr>
  		<th colspan=4 style="background-color:#004080;#ffffff;"><h4 style="color:#ffffff;">员工休假信息编辑-${user.employeeName}</h4></td>
  		</tr>
  		
  		<tr>
  		<th width="80">职位</th><td>${user.position}</td>
  		</tr>
  		
  		<tr>
  		<th>类型</th><td>${user.employeeType}</td>
  		</tr>
  		
  		<tr>
  		<th>员工编号</th><td>${user.employeeId}</td>
  		</tr>
  		
  		<tr>
  		<th>员工姓名</th><td>${user.employeeName}</td>
  		</tr>
  		
  		<tr>
  		<th>组织</td><td>${user.deptName}</td>
  		</tr>
  		
  		<tr>
  		<th>联系电话</th><td>${user.phone}</td>
  		</tr>
  		
  		<tr>
  		<th>学历</th><td>${user.education}</td>
  		</tr>
  		
  		<tr>
  		<th>工龄</th><td>${user.workAge}</td>
  		</tr>
  		
  		<tr>
  		<th>入职时间</th><td><fmt:formatDate value="${user.workDate}" pattern="yyyy-MM-dd"/></td>
  		</tr>
  		
  		
  		<tr>
  		<th>可年限天数</th><td><input Disabled="true" type="text" name="allCnt" value="${xj.allCnt }"></td>
  		</tr>
  		
  		<tr>
  		<th>已年休天数</th><td><input Disabled="true" type="text" name="useCnt" value="${xj.useCnt }"></td>
  		</tr>
  		
  		<tr>
  		<th>未年休天数</th><td><input Disabled="true" type="text" name="restCnt" value="${xj.restCnt }"></td>
  		</tr>
  		
  		<tr>
  		<th>已休假备注</th><td><textarea Disabled="true" rows="2" cols="18" name="restRemark" value="${xj.restRemark}">${xj.restRemark}</textarea></td>
  		</tr>
  		
  		<tr>
  		<th>其他备注</th><td><textarea Disabled="true" rows="2" cols="18" name="remark" value="${xj.remark}">${xj.remark}</textarea></td>
  		</tr>
  		
  		<tr>
  		  <td colspan=2><hr style="border:thin dashed 1px #ccc;"></td>
  		</tr>
  		
  		<form id="theForm" method="post">
  		<tr>
  		<th>假期类型</th>
  		<td>
  		<select name="xjOrder">
  			<%=StringUtil.getOptions(new String[]{"年休","调休","事假","病假","产假","探亲假","婚假","丧假","护理假","旷工","迟到","早退"},new String[]{"年休","调休","事假","病假","产假","探亲假","婚假","丧假","护理假","旷工","迟到","早退"},"") %>
  		</select>
  		</td>
  		</tr>
  		
  		<tr>
  		<th>天数</th><td>
  		<input id="orderDays" type="text" name="orderDays" value="${xjExt.orderDays}">
  		<input type="hidden" id="restDays" value="${xj.restCnt }">
  		</td>
  		</tr>
  		
  		<tr>
  		<th>请假备注</th><td><textarea id="xjRemark" rows="2" cols="18" name="remark">${xjExt.remark}</textarea></td>
  		</tr>
  		
  		<tr>
  		<td colspan=2>
  		<input type="hidden" name="id" value="${xj.id}">
  		<input type="button" onclick="f_edit();" value="提交休假请求">
  		<input type="reset" value=" 重 置 ">
  		</td>
  		</tr>
  		</form>
  		
  		</table>
  	</c:otherwise>
  </c:choose>
  
  
  
  </body>
</html>



